home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / ListTestView.cp next >
Text File  |  1997-06-28  |  876b  |  45 lines

  1. // ListTestView.cp
  2.  
  3. #ifndef ListTestView_h
  4. #include "ListTestView.h"
  5. #endif
  6. #ifndef ForegroundColorMaintainer_h
  7. #include "ForegroundColorMaintainer.h"
  8. #endif
  9. #ifndef ViewMap_h
  10. #include "ViewMap.h"
  11. #endif
  12.  
  13. ListTestView::ListTestView()
  14.   : cell( 0 )
  15.   {
  16.     SetCellHeight( 2 );
  17.     AddedCells( Range<uint32>( 0, 256 ) );
  18.   }
  19.  
  20. const ViewCell& ListTestView::operator[]( uint32 index ) const
  21.   {
  22.     const_cast<ColorCell&>(cell) = ColorCell( index );
  23.     return cell;
  24.   }
  25.  
  26. ViewCell& ListTestView::operator[]( uint32 index )
  27.   {
  28.     cell = ColorCell( index );
  29.     return cell;
  30.   }
  31.  
  32. ListTestView::ColorCell::ColorCell( uint32 index )
  33.   {
  34.     Assert( index < 256 );
  35.     color.red = index * 0x101;
  36.     color.green = index * 0x000;
  37.     color.blue = index * 0x101;
  38.   }
  39.  
  40. void ListTestView::ColorCell::Draw( const ViewMap& map ) const
  41.   {
  42.     ForegroundColorMaintainer cm( color );
  43.     PaintRect( &map.VisibleBounds() );
  44.   }
  45.